package com.lyc.mapper;

import com.lyc.pojo.User;
import org.mybatis.spring.support.SqlSessionDaoSupport;

import java.util.List;

public class UserMapperIpml extends SqlSessionDaoSupport implements UserMapper{
    @Override
    public List<User> selectUser() {
        User lyc = new User(5, "lyc", "123");
        UserMapper mapper = getSqlSession().getMapper(UserMapper.class);
        mapper.addUser(lyc);
        mapper.deleteUser(5);
        return mapper.selectUser();
    }

    @Override
    public int addUser(User user) {
        return getSqlSession().getMapper(UserMapper.class).addUser(user);
    }

    @Override
    public int deleteUser(int id) {
        return getSqlSession().getMapper(UserMapper.class).deleteUser(id);
    }
//我们的所有操作，都是使用sqlSession来执行，在原来，现在都是用SqlSessionTemplate（模板）

}
